package com.autonomous_printer.controller;


import com.autonomous_printer.util.PrinterStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class IndexController {

    @Autowired
    PrinterStatus printerStatus;

    @GetMapping({"/index", "/index.html", "/"})
    public String index() {
        return "index";
    }

    @GetMapping({"/explain", "/explain.html"})
    public String explainPage() {
        return "explain";
    }

    @GetMapping({"/login", "/login.html"})
    public String loginPage() {
        return "manage/login";
    }

    @GetMapping({"/status", "/status.html"})
    public String statusPage(Model model) {
        model.addAttribute("page", printerStatus.getPage());
        model.addAttribute("ink", printerStatus.getInk());
        model.addAttribute("able", printerStatus.isAble());
        return "status";
    }
}
